<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>SLOOK</title>
  <%
  String scheme = request.getScheme();
  String serverName = request.getServerName();
  int serverPort = request.getServerPort();
  String contextPath = request.getContextPath();

  String basePath = scheme + "://" + serverName + ":" + serverPort + contextPath + "/";
  %>
  <base href="<%=basePath%>">

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="dist/css/adminlte.min.css">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <c:import url="../all/head.jsp"/>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="index3.html" class="brand-link">
      <img src="dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">SLOOK</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar user (optional) -->
      <div class="user-panel mt-3 pb-3 mb-3 d-flex">
        <div class="image">
          <img src="dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image">
        </div>
        <div class="info">
          <a href="#" class="d-block">${sessionScope.name}</a>
        </div>
      </div>

      <!-- SidebarSearch Form -->
      <div class="form-inline">
        <div class="input-group" data-widget="sidebar-search">
          <input class="form-control form-control-sidebar" type="search" placeholder="Search" aria-label="Search">
          <div class="input-group-append">
            <button class="btn btn-sidebar">
              <i class="fas fa-search fa-fw"></i>
            </button>
          </div>
        </div>
      </div>

      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <!-- Add icons to the links using the .nav-icon class
             with font-awesome or any other icon font library -->

          <li class="nav-item menu-open">
            <a href="#" class="nav-link active">
              <i class="nav-icon fas fa-table"></i>
              <p>
                查看
                <i class="fas fa-angle-left right"></i>
              </p>
            </a>
            <ul class="nav nav-treeview">
              <li class="nav-item">
                <a href="<%=request.getContextPath()%>/allData" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>学生</p>
                </a>
              </li>
              <li class="nav-item">
                <a href="<%=request.getContextPath()%>/getAllCourses" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>课程</p>
                </a>
              </li>
              <li class="nav-item">
                <a href="<%=request.getContextPath()%>/getWeather" class="nav-link">
                  <i class="far fa-circle nav-icon"></i>
                  <p>天气</p>
                </a>
              </li>
              <li class="nav-item">
                <a href="<%=request.getContextPath()%>/getAllNotice/admin" class="nav-link active">
                  <i class="far fa-circle nav-icon"></i>
                  <p>公告</p>
                </a>
              </li>
            </ul>
          </li>
        </ul>
        </li>

        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>查看</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item active">查看</li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- /.row -->
        <!-- /.row -->
        <!-- /.row -->
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">公告栏</h3>
                <a href="pages/users/addNotice.jsp">添加公告</a>
              </div>
              <!-- ./card-header -->
              <div class="card-body">
                <table class="table table-bordered table-hover">
                  <c:forEach items="${sessionScope.notices}" var="notice">
                  <thead>
                    <tr>
                      <th>ID</th>
                      <th>Creator</th>
                      <th>操作1</th>
                      <th>操作2</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr data-widget="expandable-table" aria-expanded="false">
                      <td>${notice.id}</td>
                      <td>${notice.creator}</td>
                      <td>
                        <a href="<%=request.getContextPath()%>/getNotice/${notice.id}">
                        <button type="button" class="btn btn-block bg-gradient-info">修改
                        </button>
                      </a>
                      </td>
                      <td>
                        <a class="deleteStu" href="<%=request.getContextPath()%>/deleteNotice/${notice.id}">
                          <button type="button" class="btn btn-block bg-gradient-warning">删除
                          </button>
                        </a>
                      </td>
                    </tr>
                    <tr class="expandable-body">
                      <td colspan="5">
                        <p>
                          ${notice.content}
                        </p>
                      </td>
                    </tr>
                  </tbody>
                  </c:forEach>
                </table>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
        </div>
        <!-- /.row -->
        <!-- /.row -->
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <footer class="main-footer">

  </footer>

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Control sidebar content goes here -->
  </aside>
  <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>
</body>
</html>
